<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>layout布局页面</title>
    <script type="text/javascript" src="../js/jquery-1.8.3.js" ></script>
    <script type="text/javascript" src="../js/easyui/jquery.easyui.min.js" ></script>
    <script type="text/javascript" src="../js/easyui/locale/easyui-lang-zh_CN.js" ></script>
    <script type="text/javascript" src="../js/ztree/jquery.ztree.all-3.5.js" ></script>
    <link rel="stylesheet" href="../js/easyui/themes/default/easyui.css" />
    <link rel="stylesheet" href="../js/easyui/themes/icon.css" />
	<link rel="stylesheet" href="../js/ztree/zTreeStyle.css" />    
    <script type="text/javascript">
    	$(function(){
    		/*$("#lklink").click(function(){
    			$("#mytabs").tabs('add',{
    				title:'来看阅读',
    				content:'来看阅读-免费小说',
    				closable:true
    			});
    		});*/
    		// 1、 进行ztree菜单设置 
    		var setting ={
    			data:{
    				simpleData:{
    					enable:true//支持简单json数据格式
    				}
    			},
    			callback:{
    				onClick:function(event,treeId,treeNode,clickFlag){
    					var content = '<div style="width: 100%;height: 100%; overflow: hidden;">'
        					+'<iframe src="'
        					+treeNode.page
        					+'" scrolling="auto" style="width: 100%; height: 100%; border: 0;"></iframe></div>';
    					/*选择属性，如果没有page属性不打开选项卡*/
    					if(treeNode.page!=undefined && treeNode.page!=""){
    						/*如果选项卡已打开，选中该选项卡*/
    						if($("#mytabs").tabs('exists',treeNode.name)){
    							$("#mytabs").tabs('select',treeNode.name);
    						}else{
    							$("#mytabs").tabs('add',{
    								title:treeNode.name,
    								content:content,
    								closable:true
    							});
    						}
    					}
    				}	
    			}
    		};
    		// 2、提供ztree树形菜单数据 
    		var zNodes = [
    			{id:1,pId:0,name:"父节点一"},
    			{id:2,pId:0,name:"父节点二"},
    			{id:11,pId:1,name:"子节点一"},
    			{id:12,pId:1,name:"子节点二"},
    			{id:21,pId:2,name:"子节点三",page:"http://www.baidu.com"},
    			{id:22,pId:2,name:"子节点四",page:"http://www.163.com"}
    		]
    		// 3、生成菜单
    		$.fn.zTree.init($("#baseMenu"),setting,zNodes);
    		
    		// 对选项卡注册 右键事件
    		$("#mytabs").tabs({
    			onContextMenu:function(e,title,index){
    				// 阻止默认菜单显示
    				e.preventDefault();
    				
    				// 显示自定义右键菜单
    				$("#mm").menu('show',{
    					/*显示在鼠标位置*/
    					left:e.pageX,
    					top:e.pageY
    				});
    			}
    		});
    	});
    </script>
</head>
<body class="easyui-layout">
    <div data-options="region:'north',title:'管理系统'" style="height: 100px;">北部区域</div>
    <div data-options="region:'west',title:'菜单导航'" style="width: 180px;">
        <!--折叠菜单-->
        <div class="easyui-accordion" data-options="fit:true">
        	<div data-options="title:'基础菜单'">
        		<!--<a href="javascript:void(0)" id="lklink">来看阅读</a>-->
        		<ul id="baseMenu" class="ztree"></ul>
        	</div>
        	<div data-options="title:'系统菜单'">
        		<!--面板二-->
        		<a href="#" class="easyui-menubutton" data-options="iconCls:'icon-save',menu:'#pmm'">
        			系统菜单
        		</a>
        	</div>
        	<div data-options="title:'管理菜单'">面板三</div>
        </div>
    </div>
    <div data-options="region:'center'">
    	<!--选项卡页面 中部区域-->
    	<div id="mytabs" class="easyui-tabs" data-options="fit:true">
    		<div data-options="title:'选项卡一',closable:true">选项卡页面一</div>
    		 <div data-options="title:'选项卡二',closable:true">选项卡页面二</div>
    	</div>
    </div>
    <div data-options="region:'east'" style="width: 80px;">东部区域</div>
    <div data-options="region:'south'" style="height: 80px;">南部区域</div>
    
    <!--右键菜单-->
    <div id="mm" class="easyui-menu" style="width: 120px;">
    	<div>关闭当前窗口</div>
    	<div>关闭其他窗口</div>
    	<div class="menu-sep"></div>    	
    	<div data-options="iconCls:'icon-cancel'">关闭全部窗口</div>    
    </div>
    
    <!--下拉菜单-->
     <div id="pmm" style="width: 120px;">
    	<div>菜单一</div>
    	<div>菜单二</div>
    	<div class="menu-sep"></div>    	
    	<div>菜单三</div>    
    </div>
</body>
</html>
